package com.tool.interceptor.controller;

import com.tool.jwt.JwtUtil;
import com.tool.result.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 酒徒
 * @Version 1.0
 * @data 2024/1/25 12:59
 */
@RestController
@RequestMapping("/interceptor")
public class InterceptorController {
    @GetMapping("/check")
    public String checkInterceptor() {
        return "checkInterceptor...";
    }

    @GetMapping("/login")
    public Result loginInterceptor() {
        Map<String, Object> claims = new HashMap<>();
        claims.put("id", "9528");
        String jwt = JwtUtil.createJwt("jwt", 60 * 1000, claims);
        return Result.success(jwt);
    }

}
